package cece.controller;

import cece.entity.Movie;
import cece.entity.PageBean;
import cece.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class MovieController {

    @Autowired
    private MovieService movieService;

    @RequestMapping(value = "/movie/findAll", method = RequestMethod.GET)
    public PageBean<Movie> findAll(@RequestParam Integer currentPage, @RequestParam Integer pageSize) {
        return movieService.findAll(currentPage, pageSize);
    }

    @RequestMapping(value = "/movie/findScore",method = RequestMethod.GET)
    public List<Movie> findScore(@RequestParam Integer currentPage, @RequestParam Integer pageSize) {
        return movieService.finScore(currentPage, pageSize);
    }

    @RequestMapping(value = "/movie/findById/{mid}",method = RequestMethod.GET)
    public Movie findById(@PathVariable Integer mid){
        return movieService.findById(mid);
    }
}
